Skip to content

fix: 修复 CodeBuilder 中的循环依赖检测和代码块处理逻辑#3130

Open
Devancn wants to merge 1 commit intoalibaba:mainfrom
Devancn:fix/code-builder-cyclic-dependency-detection
Open

fix: 修复 CodeBuilder 中的循环依赖检测和代码块处理逻辑#3130
Devancn wants to merge 1 commit intoalibaba:mainfrom
Devancn:fix/code-builder-cyclic-dependency-detection

Conversation

@Devancn
Copy link

@Devancn Devancn commented Feb 28, 2025

下面的 chunk 没有循环依赖,原有逻辑会报循环依赖错误。

[{
	"name": "Template",
	"type": "string",
	"content": "<template><Page ref=\\"
	outerView\\ " :style=\\" {
		height: '100%'
	}\\
	"><Button prefix=\\"
	next - \\" type=\\"
	primary\\ " size=\\"
	medium\\ " htmlType=\\"
	button\\ " component=\\"
	button\\ ">按钮</Button></Page></template>",
	"linkAfter": []
}, {
	"name": "ScriptStart",
	"type": "string",
	"content": "<script>",
	"linkAfter": ["Template"]
}, {
	"name": "ScriptEnd",
	"type": "string",
	"content": "</script>",
	"linkAfter": ["OptionsDefineEnd"]
}, {
	"name": "OptionsDefineStart",
	"type": "string",
	"content": "export default {\\n  name: '$$Page',",
	"linkAfter": []
}, {
	"name": "OptionsDefineEnd",
	"type": "string",
	"content": "}",
	"linkAfter": ["Data", "LifeCycle", "MethodsEnd"]
}, {
	"name": "Data",
	"type": "string",
	"content": "data() { return {text: \\"
	outer\\ ",isShowDialog: false,} },",
	"linkAfter": ["OptionsDefineStart"]
}, {
	"name": "LifeCycle",
	"type": "string",
	"content": "mounted() {\\n  console.log('did mount');\\n},",
	"linkAfter": ["Data"]
}, {
	"name": "LifeCycle",
	"type": "string",
	"content": "beforeDestroy() {\\n  console.log('will unmount');\\n},",
	"linkAfter": ["Data"]
}, {
	"name": "MethodsStart",
	"type": "string",
	"content": "methods: {",
	"linkAfter": ["Data", "LifeCycle"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "testFunc() {\\n  console.log('test func');\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "onClick() {\\n  this.setState({\\n    isShowDialog: true\\n  });\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "closeDialog() {\\n  this.setState({\\n    isShowDialog: false\\n  });\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "getHelloWorldText() {\\n  return this.i18n('i18n-jwg27yo4');\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "getHelloWorldText2() {\\n  return this.i18n('i18n-jwg27yo3', {\\n    name: '絮黎'\\n  });\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "onTestConstantsButtonClicked() {\\n  console.log('constants.ConstantA:', this.constants.ConstantA);\\n  console.log('constants.ConstantB:', this.constants.ConstantB);\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsContent",
	"type": "string",
	"content": "onTestUtilsButtonClicked() {\\n  this.utils.demoUtil('param1', 'param2');\\n},",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "MethodsEnd",
	"type": "string",
	"content": "},",
	"linkAfter": ["MethodsContent"]
}, {
	"name": "MethodsStart",
	"type": "string",
	"content": "<style>",
	"linkAfter": ["ScriptEnd"]
}, {
	"name": "StyleContent",
	"type": "string",
	"content": "body {\\n  font-size: 12px;\\n}\\n\\n.button {\\n  width: 100px;\\n  color: #ff00ff\\n}",
	"linkAfter": ["MethodsStart"]
}, {
	"name": "StyleEnd",
	"type": "string",
	"content": "</style>",
	"linkAfter": ["StyleContent"]
}]

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants